<?php
/***************************************************************************
 * 
 * Copyright (c) 2010 , Inc. All Rights Reserved
 * $Id$:RpcFactory.php,2010/06/01 14:45:48 
 * 
 **************************************************************************/
 
 
 
/**
 * @file RpcFactory.php
 * @author huqingping
 * @date 2010/06/01 14:45:48
 * @version 1.0 
 * @brief 
 *  
 **/

class RpcFactory
{
	static function getRpc($bool)
	{
		if ($bool) {
			return new HttpRpc();
		}
		return new Rpc();
	}
}
class HttpRpc 
{
	function __construct()
	{
	}
	function init($mod,$conf)
	{
	}

	function rpcCall($name,$args)
	{
		if (strpos($name,'/_private/') !== false) {
			$ret = $name.count($args['rpcinput']).count($args['rpcinit']);
			return array('err'=>'ok','data'=>array('rpcret'=>$ret));
		} else {
			$ret = $name.count($args);
			return $ret;
		}
	}
}

class Rpc
{
	function init($mod,$conf)
	{
	}

	function rpcCall($name,$input)
	{
		return array('err'=>'ok','result'=>$name.count($input));
	}
}






/* vim: set ts=4 sw=4 sts=4 tw=100 noet: */
?>
